<template>
  <div class="menu-box">
    <div class="icon-box">
      <div class="icon-column1">
        <el-button
          type="primary"
          @click="createNewChat"
          class="full-width-button"
        >
          创建会话
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { useChatStore } from "@/stores/chat";

export default {
  components: {},
  props: {
    isHidden: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    toggleSidebar() {
      this.$emit("toggle-sidebar");
    },
    async createNewChat() {
      const chatStore = useChatStore();
      try {
        await chatStore.createNewChat();
      } catch (error) {
        console.error("创建新聊天失败:", error);
      }
    },
  },
};
</script>

<style scoped>
.menu-box {
  background-color: antiquewhite;
  padding: 8px; /* 添加内边距 */
}

.icon-box {
  min-width: 80px;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.icon-column1,
.icon-column2 {
  flex: 1;
  display: flex;
  align-items: center;
}

.icon-column2 {
  justify-content: flex-end;
}

/* 新增的按钮样式类 */
.full-width-button {
  width: 100%;
  margin: 0;
  padding: 8px 0;
  display: block;
}

.zhedie,
.xinduihua {
  width: 25px;
  height: 25px;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.zhedie:hover,
.xinduihua:hover {
  transform: scale(1.1);
}

.zhedie:active {
  transform: scale(1);
}
</style>